<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <body>
        <div></div>
        <script>
            //思路：先创建一个能够存放倒计时的标签
            //2、通过不停的计时器来一直显示
            //3、可以先通过一个变量来给倒计时的值。根据判断这个变量来实现具体的操作
    
            var div = document.querySelector('div');
            var tim = 5;
    
            var timer = setInterval(function(){
                if( tim == 0){
                   location.href = 'http://www.baidu.com'
                }else{
                    div.innerHTML = '页面将在' + tim + '跳转到百度首页';
                    tim--;
                } 
            },1000)
        </script>
    </body>
    
</body>
</html>